home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / lang / c++-part2 / 10913 < prev    next >
Encoding:
Internet Message Format  |  1996-08-05  |  1.6 KB

  1. Path: news.uiowa.edu!ozone!maclenna
  2. From: maclenna@ozone.uiowa.edu (Mark MacLennan)
  3. Newsgroups: comp.lang.c++
  4. Subject: Re: Major problem with strings.
  5. Date: 11 Mar 1996 07:16:06 GMT
  6. Organization: University of Iowa, Iowa City, IA, USA
  7. Distribution: world
  8. Message-ID: <4i0jvm$18q0@flood.weeg.uiowa.edu>
  9. References: <31438275.72DB@aol2.com> <4i0gn0$5g9@sam.inforamp.net>
  10. Reply-To: maclenna@cgrer.uiowa.edu(Mark MacLennan)
  11. NNTP-Posting-Host: ozone.cgrer.uiowa.edu
  12.  
  13. In article <4i0gn0$5g9@sam.inforamp.net> rmorin@inforamp.net 
  14. (Randy Charles Morin) writes:
  15. >In article <31438275.72DB@aol2.com>, Neil <neil@aol2.com> wrote:
  16. >>1    char *club="";
  17. >>2    club="/public_html/neil";
  18. >>3    strcat(club,argv[1]+5);
  19. >>4    strcat(club,"/");
  20. >
  21. >No, this just won't do.  When you want a '/' slash in C, use two slashes.  The 
  22. >'/' is also used to denote an escape sequence (for special characters).  Thus 
  23. >your code should read...
  24. >
  25. >1    char *club="";
  26. >2    club="//public_html//neil";
  27. >3    strcat(club,argv[1]+5);
  28. >4    strcat(club,"//");
  29. >
  30. >Agrivar
  31.  
  32. What nonsense!  But then this can be expected from Randy Charles Morin.
  33. The reason the above doesn't work is that the char pointer club
  34. hasn't been allocated sufficient space to store the additional characters -
  35. indeed, it has been assigned to a string constant.
  36. By the way, the slash character "/" is NOT used to denote an escape
  37. sequence - the backslash character "\" serves this purpose.
  38.  
  39. You know, Randy, you really should spend more time reading and writing
  40. some code than making these clueless postings.  Maybe you can get your
  41. father to help chip in and buy you some C/C++ books.
  42.  
  43. - MARK
  44.  
  45.